<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\api\service\HouseholdService;

/**
 * 家用电桩接口
 */
class Household extends Api
{
    protected $noNeedLogin = ['power','package','package_type'];
    protected $noNeedRight = ['*'];


    /**
     * 选择功率
     *
     */
    public function power()
    {
        $res = HouseholdService::getPower();
        return json($res);
    }

    /**
     * 选择功率
     *
     */
    public function package()
    {
        $data = $this->request->post();
        $res = HouseholdService::getPackage($data);
        return json($res);
    }

    /**
     * 选择套餐
     *
     */
    public function package_type()
    {
        $data = $this->request->post();
        $res = HouseholdService::getPackageType($data);
        return json($res);
    }

    /**
     * 创建订单
     *
     */
    public function create()
    {
        $data = $this->request->post();
        $res = HouseholdService::createOrder($data);
        return json($res);
    }
}